﻿// 商品详情

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections.Generic;
using MotionFramework.UIKit;


namespace DemoProject
{
    public class GoodsInfoForms : UIWindow
    {
        public Text TxtPropDetailTitle;             //道具详细信息标题
        public Text TxtConfirm;                     //确认
        public Text TxtCancle;                      //取消

        protected override void OnInit()
        {
            //本窗体属性
            CurrentUIType.UIWindow_Type = UIWindowType.PopUp;
            CurrentUIType.UIWindow_ShowMode = UIWindowShowMode.ReverseChange;

            //事件注册
            AddClickEventListener("ImgPurchse",
                () => ShowUIWindow(UIWindowID.ConfirmForms.ToString())
            );
            AddClickEventListener("ImgCancle",
                () => CloseUIWindow<MarketForms>()
            );

            // //添加消息监听
            // MessageCenter.AddMsgListener(SysConst.MarketInfo,
            //     p =>
            //     {
            //         if (p.Key.Equals(SysConst.MarketInfo_PropDetailInfo))
            //         {
            //             if (TxtPropDetailTitle)
            //             {
            //                 TxtPropDetailTitle.text = p.Values.ToString();
            //             }
            //         }    
            //     }
            //     );
        }//Awake_end

        #region  窗体生命周期
        protected override void OnEnter()
        {
            if (TxtConfirm)
            {
                TxtConfirm.text = ShowText("Confirm");
            }
            if (TxtCancle)
            {
                TxtCancle.text = ShowText("Cancle");
            }
        }

        protected override void OnReEnter()
        {
            base.OnReEnter();
        }

        protected override void OnFreeze()
        {
            base.OnFreeze();
        }

        protected override void OnExit()
        {
            base.OnExit();
        }
        #endregion

        //显示商品信息的标题。（不用Lamda 的传统写法）
        //private void ShowGoodsInfoTitle(KeyValuesUpdate kv)
        //{
        //    if (kv.Key.Equals("PropDetailInfoTitle"))
        //    {
        //        if (TxtPropDetailTitle)
        //        {
        //            TxtPropDetailTitle.text = kv.Values.ToString();
        //        }
        //    }            
        //}
    }//Class_end
}